<?php
	/**
	 * Includes Path Info Class
	 */
	require_once dirname(dirname(dirname(__FILE__))) . "/Code/cCodeInfo.php";
	/**
	 * Include Install History class
	 */
	require_once PHPLog\cCodeInfo::C_STR_CODE . "/Code/Classes/Updater/cHistory_PHP_Log.php";
	/**
	 * Include Install Reposetory class
	 */
	require_once PHPLog\cCodeInfo::C_STR_CODE . "/Code/Classes/Updater/cRepository_PHP_Log.php";

	$obj_Install_History = null;
	$obj_Update_Repo = null;
	$obj_Update = null;
	//$str_History_File		= PHPLog\cCodeInfo::C_STR_CODE."/Setup/cCodeInfo.php";

	$obj_Install_History = new cHistory_PHP_Log();

	print("<h2>Loading Current Version</h2>");

	$obj_Install_History->print_Info("<br/>\n");

	print("<h2>Loading Repository</h2>");

	flush();
	$obj_Update_Repo = new cRepository_PHP_Log($obj_Install_History->get_UpdateURL());
	if ($obj_Update_Repo->is_Loaded())
	{
		print("- Successful.");
	}
	else
	{
		print("- Failed.");
		die();
	}

	print("<h2>Find updates for " . $obj_Install_History->get_Application() . "</h2>");
	flush();
	$obj_Update = $obj_Update_Repo->get_Update($obj_Install_History->get_Application(),
		$obj_Install_History->get_Version(),
		"<br/>\n");
	if ($obj_Update)
	{
		print("- Updateing to verion " . $obj_Update->get_NewVer() . "<br/>");
		$obj_Install_History->do_Update($obj_Update, true, "<b>", "<b/><br/>");
	}
	else
	{
		print("- No Updates Available.<br/>");
		die();
	}
	/*
	 function get_BasePath($str_Code)
	 {
	 $str_Output = "";
	 switch ($str_Code)
	 {
	 case "code" :
	 $str_Output = cInfo::c_Path2UserManagerCode;
	 break;
	 case "webpage" :
	 $str_Output = (dirname(dirname(__FILE__)));
	 break;
	 default :
	 break;
	 }
	 $str_Output = str_replace("\\", "/", $str_Output);
	 return $str_Output;
	 }
	 */
?>
